<?php
include_once 'include.php';
check_login();
$total = sql_count('lyy_member','id,username,email,phone,identity','del=1');#总行数
$curr = isset($_REQUEST['curr'])?$_REQUEST['curr']:1;#当前页
$limit = 10;#每页多少行
$page = ceil($total/$limit);#总共有多少页
$lists = page('lyy_member','id,username,email,phone,identity',$curr,$limit,'del=1');#用户列表
?>
<!DOCTYPE html>
<html>
<head>
    <?php include_once 'common_js_css.php'?>
    <link rel="stylesheet" type="text/css" href="css/adyonghu.css">
    <script src="js/adyonghu.js"></script>
</head>
<body>
<div class="cont" style="height: 730px">
    <h1 style="text-align: center;">用户列表</h1>
    <form name="form1" method="post" action="">
      <table width="930"  align="center" cellspacing="0" style="margin: 40px 0 40px 80px;">
        <tr>
          <th width="45" height="35" scope="col">序号</th>
          <th width="150" height="35" scope="col">用户名</th>
          <th width="150" height="35" scope="col">角色</th>
          <th width="251" height="35" scope="col">联系电话</th>
          <th width="250" height="35" scope="col">邮箱地址</th>
          <th width="58" height="35" scope="col">&nbsp;</th>
        </tr>
          <?php foreach ($lists as $list) :?>
        <tr>
          <td height="35" align="center"><?php echo $list['id'];?></td>
          <td height="35" align="center"><?php echo $list['username'];?></td>
          <td height="35" align="center"><?php if ($list['identity']==1)echo '管理员';else{echo '普通用户';} ?></td>
          <td width="251" height="35" align="center"><?php echo $list['phone'];?></td>
          <td height="35" align="center" valign="middle"><?php echo $list['email'];?></td>
          <td height="35" align="center"><input type="submit" onclick="del('lyy_member','<?php echo $list['id'];?>')" value="删除"></td>
        </tr>
          <?php endforeach;?>
          <tr>
              <td colspan="6" align="center">
                  <!--显示分页，只有一页，即不显示分页-->
                  <?php if($total>$limit){echo showPage($curr,$page);}?>
                  <input name="Submit2" class="print" type="button" onClick="javascript:window.print();" value="打印本页" />
              </td>
          </tr>
      </table>
    </form>
</div>
</body>
</html>